package com.run2code.design.creational.builder.demo01;

/**
 * 定义指挥者类
 * 关注公众号【奔跑的码畜】，一起进步不迷路
 *
 * @author 第七人格
 * @date 2023/11/20
 */
public class Commander {
    /**
     * 注入StudentBuilder
     */
    private StudentBuilder studentBuilder;

    public void setStudentBuilder(StudentBuilder studentBuilder) {
        this.studentBuilder = studentBuilder;
    }

    public Student makeStudent(String name, int age) {
        this.studentBuilder.buildAge(age);
        this.studentBuilder.buildName(name);
        return this.studentBuilder.makeStudent();
    }
}
